﻿/**
 * ...
 * @author George Mavchun
 */

package gui.hug.priv;

import gui.hug.HUGButton;
import gui.hug.HUGColors;

class HUGCheckBoxButton extends HUGButton 
{
	private var checked : Bool;	

	public function new(checked : Bool) 
	{
		super("");
		this.checked = checked;
		refreshStates("");
	}
	
	override private function refreshStates(text : String) {
		downState = new HUGCheckBoxButtonDisplayState(HUGColors.VK_BORDER_INNER, checked);
		overState = new HUGCheckBoxButtonDisplayState(HUGColors.VK_BORDER_INNER, checked);
		upState = new HUGCheckBoxButtonDisplayState(HUGColors.WHITE, checked);
		hitTestState = new HUGCheckBoxButtonDisplayState(HUGColors.WHITE, checked);
	}
	
	public function isChecked() : Bool {
		return this.checked;
	}
	
	public function setChecked(checked : Bool) {
		this.checked = checked;
		refreshStates("");
	}
	
	public function changeChecked() {
		this.checked = !this.checked;
		refreshStates("");
	}
}